package com.cndw.kungfu.vo;

import com.cndw.kungfu.domain.Player;
import com.cndw.kungfu.domain.Union;

/**
 * 
 * @author <a href="mailto:whz-work@163.com">汪洪州</a>
 * 
 * @since 1.0 Create on 2011-5-20
 */
public class UnionMemberVO implements Comparable<UnionMemberVO> {

	/**
	 * 帮派ID
	 */
	private int unionId;

	/**
	 * 帮派名字
	 */
	private String unionName;

	/**
	 * 玩家ID
	 */
	private long playerId;

	/**
	 * 玩家名字
	 */
	private String playerName;

	/**
	 * 玩家等级
	 */
	private int playerLevel;

	/**
	 * 玩家职业
	 */
	private int playerVocation;

	/**
	 * 玩家当前状态
	 */
	private boolean playerStatus;

	/**
	 * 最后在线
	 */
	private int playerLastLogin;
	/**
	 * 离线时间
	 */
	private int offLineTime;
	/**
	 * 贡献值
	 */
	private int resource;

	/**
	 * 历史贡献值
	 */
	private int hissource;

	/**
	 * 玩家职业
	 */
	private int position;

	/**
	 * 入帮时间
	 */
	private int addTime;

	/**
	 * 申请时间或者邀请时间
	 */
	private int timstamp;

	/**
	 * 摇钱树领取次数
	 */
	private int counts;

	/**
	 * 摇钱树浇水时间
	 */
	private int waterTime;

	/**
	 * 摇钱树奖励领取时间
	 */
	private int getTime;

	/**
	 * 成员权限
	 */
	private int permission;

	/**
	 * 附加权限
	 */
	private int flag;

	public int getUnionId() {
		return unionId;
	}

	public void setUnionId(int unionId) {
		this.unionId = unionId;
	}

	public long getPlayerId() {
		return playerId;
	}

	public void setPlayerId(long playerId) {
		this.playerId = playerId;
	}

	public String getPlayerName() {
		return playerName;
	}

	public void setPlayerName(String playerName) {
		this.playerName = playerName;
	}

	public boolean getPlayerStatus() {
		return playerStatus;
	}

	public void setPlayerStatus(boolean playerStatus) {
		this.playerStatus = playerStatus;
	}

	public int getPosition() {
		return position;
	}

	public void setPosition(int position) {
		this.position = position;
	}

	public int getAddTime() {
		return addTime;
	}

	public void setAddTime(int addTime) {
		this.addTime = addTime;
	}

	public String getUnionName() {
		return unionName;
	}

	public void setUnionName(String unionName) {
		this.unionName = unionName;
	}

	public int getPlayerLevel() {
		return playerLevel;
	}

	public void setPlayerLevel(int playerLevel) {
		this.playerLevel = playerLevel;
	}

	public int getPlayerVocation() {
		return playerVocation;
	}

	public void setPlayerVocation(int playerVocation) {
		this.playerVocation = playerVocation;
	}

	public int getPlayerLastLogin() {
		return playerLastLogin;
	}

	public void setPlayerLastLogin(int playerLastLogin) {
		this.playerLastLogin = playerLastLogin;
	}

	public int getResource() {
		return resource;
	}

	public void setResource(int resource) {
		this.resource = resource;
	}

	public int getHissource() {
		return hissource;
	}

	public void setHissource(int hissource) {
		this.hissource = hissource;
	}

	public int getTimstamp() {
		return timstamp;
	}

	public void setTimstamp(int timstamp) {
		this.timstamp = timstamp;
	}

	public int getCounts() {
		return counts;
	}

	public void setCounts(int counts) {
		this.counts = counts;
	}

	public int getWaterTime() {
		return waterTime;
	}

	public void setWaterTime(int waterTime) {
		this.waterTime = waterTime;
	}

	public int getGetTime() {
		return getTime;
	}

	public void setGetTime(int getTime) {
		this.getTime = getTime;
	}

	public int getPermission() {
		return permission;
	}

	public void setPermission(int permission) {
		this.permission = permission;
	}

	public int getFlag() {
		return flag;
	}

	public void setFlag(int flag) {
		this.flag = flag;
	}

	public int getOffLineTime() {
		return offLineTime;
	}

	public void setOffLineTime(int offLineTime) {
		this.offLineTime = offLineTime;
	}

	public static UnionMemberVO newUnionMemberVO(Union union, Player player, int timestamp) {
		UnionMemberVO memberVO = new UnionMemberVO();
		memberVO.setUnionId(union.getId());
		memberVO.setUnionName(union.getName());
		memberVO.setPlayerId(player.getPlayerId());
		memberVO.setPlayerLevel(player.getLevel());
		memberVO.setPlayerName(player.getPlayerName());
		memberVO.setPlayerVocation(player.getVocationId());
		memberVO.setTimstamp(timestamp);
		return memberVO;
	}

	@Override
	public int compareTo(UnionMemberVO o) {
		if (getPlayerStatus() == o.getPlayerStatus()) {
			if (getPosition() > o.getPosition()) {
				return 1;
			} else if (getPosition() < o.getPosition()) {
				return -1;
			} else {
				if (getHissource() > o.getHissource()) {
					return 1;
				} else {
					return -1;
				}
			}
		}

		return 0;
	}
}